#include "stdafx.h"
#include "Explosion.h"

#include "../../Framework/ContentManager.h"

namespace MyGame {

Explosion::Explosion(Game* game) : Quad(game) {
    this->SetEffectFile("Explosion.fx");
}

Explosion::~Explosion(void) {
}

void Explosion::Draw(FLOAT timeDelta) {
    D3DXMATRIX mWorld = this->GetWorldMatrix();
    D3DXMATRIX mWorldViewProjection = mWorld * this->GetGame()->GetCamera()->GetViewMatrix() * this->GetGame()->GetCamera()->GetProjectionMatrix();
    this->effect->SetMatrix("g_mWorldViewProjection", &mWorldViewProjection) ;
    this->effect->SetFloat("time_0_X", this->GetAlpha());
    this->effect->SetFloat("speed", 1);
    this->effect->SetTechnique("Particle_Shader_Normal_Alpha");
    __super::Draw(timeDelta);
}

void Explosion::LoadContent() {
    __super::LoadContent();

    IDirect3DVolumeTexture9* noiseTexture = this->GetGame()->GetContentManager()->LoadVolumeTexture("NoiseVolume.dds");
    this->effect->SetTexture("g_NoiseTexture", noiseTexture);
    IDirect3DTexture9* flameTexture = this->GetGame()->GetContentManager()->LoadTexture("flame.tga");
    this->effect->SetTexture("g_FlameTexture", flameTexture);
}

}
